CSharpTest.Net
SynchronizedDictionary<TKey,TValue> Constructor(IEqualityComparer<TKey>)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > SynchronizedDictionary<TKey,TValue> Class > SynchronizedDictionary<TKey,TValue> Constructor : SynchronizedDictionary<TKey,TValue> Constructor(IEqualityComparer<TKey>)

comparer

Glossary Item Box

Constructs a thread-safe generic collection of key/value pairs using exclusive locking.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal comparer As IEqualityComparer(Of TKey) _
)
C# 
public SynchronizedDictionary<TKey,TValue>( 
   IEqualityComparer<TKey> comparer
)

Parameters

comparer

Example

Library/Library.Test/TestSynchronizedCollections.cs

C#Copy Code
SynchronizedDictionary<string, string> test = new SynchronizedDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
test["a"] = "b";
Assert.IsTrue(test.ContainsKey("A"));

test = new SynchronizedDictionary<string, string>(StringComparer.OrdinalIgnoreCase, new IgnoreLocking());
test["a"] = "b";
Assert.IsTrue(test.ContainsKey("A"));
VB.NETCopy Code
Dim test As New SynchronizedDictionary(Of String, String)(StringComparer.OrdinalIgnoreCase)
test("a") = "b"
Assert.IsTrue(test.ContainsKey("A"))

test = New SynchronizedDictionary(Of String, String)(StringComparer.OrdinalIgnoreCase, New IgnoreLocking())
test("a") = "b"
Assert.IsTrue(test.ContainsKey("A"))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys